package com.mengpeng.toastutils

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import cn.coderdream.mtoast.MToastUtils
import cn.coderdream.mtoast.ToastUtils
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        textView_success.setOnClickListener {
            MToastUtils.getInstance()
                    .with(this)
                    .content("ADC")
                    .show()
//            MToastUtils.getInstance()
//                    .with(this)
//                    .content("ADC", Color.parseColor("#ff00ff"))
//                    .duration(Toast.LENGTH_SHORT)
//                    .background(R.drawable.toast_error_shape)
//                    .gravity(Gravity.CENTER, 100, 100)
//                    .show()
        }
//        textView_success.setOnClickListener {
//            ToastUtils.onSuccessShowToast("成功toast")
//        }

        textView_error.setOnClickListener {
            ToastUtils.onErrorShowToast("失败toast")
        }

        textView_default.setOnClickListener {
            ToastUtils.onDefaultShowToast("默认toast")
        }
        textView_warn.setOnClickListener {
            ToastUtils.onWarnShowToast("Warn toast")
        }
        textView_info.setOnClickListener {
            ToastUtils.onInfoShowToast("Info toast")
        }
        textView_custum1.setOnClickListener {
            ToastUtils.onShowToast("自定义1", 0, R.drawable.toast_custum1_shape)
        }
        textView_custum2.setOnClickListener {
            ToastUtils.onShowToast("自定义2", R.mipmap.ic_launcher_round,
                    R.drawable.toast_custum2_shape)
        }


    }
}
